home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr48 / 386p_200.zip / RM_GRAPH.TXT < prev    next >
Text File  |  1995-01-14  |  6KB  |  145 lines

  1. Graphics cards in PC compatible systems:
  2.  
  3. <it is assumed you know the basics about how display adapters work>
  4.  
  5. The first pc-compatibles had text-only monochrome display modes
  6. (using the MDA adapter) or limited color and resolution modes
  7. (using the CGA adapter).
  8.  
  9. After some years came EGA adapters, they provided up to 16 colors
  10. and 640x350 pixel screen images .... and there problems started.
  11.  
  12. "Old" PC-compatibles had a 128k "hole" in their memory map
  13. located between address A000:0000 and C000:0000
  14. where a display adapter could "locate" it's memory to let
  15. the cpu directly access it.
  16.  
  17. A "clean design" display card with 64k..256k display ram
  18. should have been designed with the capability to address at least
  19. the full 128k "adressing window" ....
  20. ... but EGA was an evolution of a previous card designed to let
  21. the cpu access the display ram in 64k blocks.
  22.  
  23. The problem other was that CGA adapter ram was mapped at
  24. B800:0000 ... C000:0000 and MDA adapter was mapped starting at B000:0000.
  25. Because it was possible to install TWO display cards
  26. (one EGA and one MDA/CGA) and EGA card could NOT ALWAYS use
  27. the B000:0000 ... C000:0000 range.
  28.  
  29. For these reasons, a EGA card in graphics mode lets you
  30. access memory thru a 64k "addressing window"
  31. mapped at A000:0000...B000:0000.
  32. In 16 color mode every pixel is mapped as 4 bits
  33. the first located in the first 64k block, the second in the second
  34. block and so on.
  35. Every pixel was mapped as 4 bits "stacked" on the same address
  36. (FOUR BITPLANES)
  37. by changing some register values you could "change the accessible 64k block"
  38. and indipendently access every bit, or if you needed to access
  39. pixels "in a single" operation, you could set a special "masking" mode
  40. to let you draw up to eight pixels in a single step.
  41.  
  42. Then came VGA, vga was really an EGA-on-steroids with higher 16 color
  43. resolution (up to 640x480) and an extra 320x200 256 colors mode (mode 13h).
  44.  
  45. Mode 13h was a so called 8bit mode (where 1 pixel maps to 1 byte).
  46.  
  47. In mode 13h a screen image "maps" into a 64000 bytes block.
  48. When in mode 13h you don't need to worry about strange memory layouts
  49. the "screen" starts at A000:0000
  50. the A000h:0000h byte is the row 0, colum  0 pixel,
  51. the A000h:0001h byte is the row 0, column 1 pixel,
  52. .....
  53. the A000h:0140h byte is the row 1, column 0 pixel,
  54. ....
  55. <and so on>
  56.  
  57. At last a "linear mapped" screen mode!
  58.  
  59. But mode 13h used just 64k while a VGA has 256k!
  60.  
  61. To "unlock" the extra kbytes and get up to FOUR 320x200 256 color
  62. disply pages you need to "turn on" mode 13h and then
  63. "turn on" the 16color "mapping model" with some twists.
  64. If you do this correcly you get what is called MODE-X.
  65.  
  66. Under mode-x you have again the four "stacked" 64k blocks
  67. but this time a screen image is "dispersed" in bytes
  68. between the four planes: a single "cpu address" maps FOUR CONSECUTIVE pixels.
  69. So for example:
  70. the A000:0000 byte maps "in four planes"
  71. the row 0,column 0 pixel (plane 0)
  72. the row 0,column 1 pixel (plane 1)
  73. the row 0,column 2 pixel (plane 2)
  74. the row 0,column 3 pixel (plane 3)
  75.  
  76. the A000:0001 byte maps "in four planes"
  77. the row 0,column 4 pixel (plane 0)
  78. the row 0,column 5 pixel (plane 1)
  79. the row 0,column 6 pixel (plane 2)
  80. the row 0,column 7 pixel (plane 3)
  81.  
  82. And so on ....
  83.  
  84. The problem with mode-x is that it lets you access up to 256k in a
  85. contorted way, but no more.
  86. Current SuperVGA cards have 1Mbyte of ram or more...
  87. To let you access this extra ram the SVGA designers added
  88. another "paging" method.
  89.  
  90. When SVGA modes are active, display memory is "visible to the graphics chips"
  91. as a linear block of memory, but the CPU can see it only
  92. in 64k blocks , to change the "visible" block the CPU must change
  93. the value of a "dispaly paging" register.
  94.  
  95. This SVGA paging is not starndardized, some boards allow
  96. TWO "visible" blocks with sizes ranging from 32k to 128k
  97. both read/write or one readable and the other writable
  98. or just a single read/write block.
  99.  
  100. This explains why very few dos programs handle SVGA modes.
  101.  
  102. To take care of this Windows uses DISPLAY DEVICE DRIVERS (software modules
  103. that lets you handle the screen device in a unified way "hiding"
  104. the different paging and mapping methods).
  105.  
  106. The VESA consortium added an "extended bios" specification to let
  107. dos programs "virtualize" the different svga cards.
  108. The VESA BIOS (either included into ROM on a svga card or provided
  109. as a TSR program) lets you control paging and video mode initalization
  110. of different svga cards in an unified way.
  111.  
  112. A recent addition to this "addressing chaos" is LINEAR APERTURE MAPPING.
  113. On newer cards (well, even on old ET3000 cards) you can tell the
  114. display card to "map" all the display memory as a countigous block
  115. into extended memory (memory above the first megabyte).
  116. This way, once you get the "base address" of the linear block
  117. you don't have to worry about paging and run your graphics code
  118. at full speed (because with fully linear mapping you eliminate
  119. the "limit checking" needed to detect when to "change page").
  120.  
  121. 386Power "runs alone" in protected mode, so the XVD drivers have been
  122. designed to:
  123.         a) ALWAYS map memory in linear mode
  124.         b) UNIFY the video page addressing modes
  125.         c) TAKE ADVANTAGE OF LINEAR APERTURE (if possible)
  126.  
  127. because of this ...
  128.  
  129. a) The XVD driver must be capable to map MULTIPLE 320x200 pages
  130.    on every svga board.
  131.    If higher resolution modes are possible,it can use 'em
  132.    with or without paging.
  133. b) Video paging is assumed to be possible in single readable/writable
  134.    64k blocks with a 64k granularity (this was the lowest common denominator)
  135.    If different layouts are present, the driver can "convert on the flight"
  136.    to an equivalent single 64k page layout.
  137. c) It is possible to check for linear aperture and enable it.
  138.  
  139. The XVD driver provides "just the basics", the other things are up to
  140. the "video module".
  141. The current 386video module just handles multi-page 320x200 video modes
  142. (well if you want to "turn on" the extra functionalities of
  143. XVD driver, simple enhance 386video).
  144.  
  145.